﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FeedAgregator;




public partial class StoreMasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadCategories();
            LoadTags();

        }
    }

    private void LoadTags()
    {
        List<Tag> tags = DataAccessHelper.GetAllTags();
        TagCloud.DataTextField = "TagName";
        TagCloud.DataTitleField = "TagName";
        TagCloud.DataWeightField = "Weight";
        TagCloud.DataHrefField = "TagName";
        TagCloud.DataHrefFormatString = "~/?tag={0}";
        TagCloud.DataSource = tags;
        TagCloud.DataBind();        
        //TagCloud.DataBind();

    }

    private void LoadCategories()
    {
        List<FeedCategory> categories = DataAccessHelper.GetAllCategories();
        CategoriesListView.DataSource = categories;
        CategoriesListView.DataBind();
    }
}
